<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"></c:set>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="${ctx}/UiMaker/css/style.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/UiMaker/css/select.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${ctx}/UiMaker/js/jquery.js"></script>
<script type="text/javascript" src="${ctx}/UiMaker/js/jquery.idTabs.min.js"></script>
<script type="text/javascript" src="${ctx}/UiMaker/js/select-ui.min.js"></script>
  
<script type="text/javascript">
$(document).ready(function(e) {
    $(".select1").uedSelect({
		width : 345			  
	});
	$(".select2").uedSelect({
		width : 167  
	});
	$(".select3").uedSelect({
		width : 100
	});
});
</script>
</head>
<body>
	<div class="place">
		<span>位置：</span>
		<ul class="placeul">
			<li><a href="#">首页</a></li>
			<li><a href="#">系统管理</a></li>
			<li><a href="#">用户管理</a></li>
		</ul>
	</div>
	<div class="formbody">

		<div class="formtitle">
			<span>基本信息</span>
		</div>
		<form action="" method="post">
			<ul class="forminfo">
				
				<c:if test="${!empty model.id}">
					<li>
						<label>用户编号</label>
						<input id="id" name="id" type="text" class="dfinput" readonly="readonly" value="${model.id}" /><i></i>
					</li>
				</c:if>
				
				<li>
					<label>用户名称</label>
					<input name="username" type="text" class="dfinput" value="${model.username}" />
				</li>
				
				<li>
					<label>用户密码</label>
					<input name="password" type="text" class="dfinput" value="${model.password}" />
				</li>
				
				<li>
					<label>用户电话</label>
					<input name="phone" type="text" class="dfinput" value="${model.phone}" />
				</li>
				
				<li>
					<label>用户邮件</label>
					<input name="email" type="text" class="dfinput" value="${model.email}" />
				</li>
				
				<li><label>用户角色</label>    
				    <div class="vocation">
					    <select name="roleID" class="select1">
						    <c:forEach items="${roles}" var="role">
						    	<option value="${role.id}" ${(model.role.id == role.id)?'selected':''}>${role.rolename}</option>								   					    					   
						    </c:forEach>
					    </select>
				    </div>
			    </li>
					
				<li>
					<label>&nbsp;</label>					
					<%-- <input name="btnSave" type="button" class="btn" value="确认保存" onclick="window.location.href='${ctx}/role/add'" /> --%>					
					<input id="btnEdit" name="btnEdit" type="submit" class="btn" value="确认保存" onclick="edit();" />
					<input name="btnSave" type="button" class="btn" value="返回" onclick="window.history.back(-1)" />					
				</li>		
			</ul>
		</form>		
	</div>
</body>
<script type="text/javascript">
	function edit(){
		var id=$("#id").val();
		//var actionUrl="${ctx}/role/add";
		if(id != null){
			$("form").attr("action","${ctx}/user/edit");			
		}else{
			$("form").attr("action","${ctx}/user/add");
		}
		$("form").submit();	
	}
	$(document).ready(function(){
		
	})
</script>
</html>